<?php

use Illuminate\Database\Seeder;
use App\Models\Admin1;
use Faker\Factory;

class Admin1TableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        //新增数据

//        Admin1::truncate();
//        $faker = Factory::create('zh_CN');
//
//        $data = [];
//        for ($i=0;$i<10000;$i++){
//            $data[] = [
//                'name'=>$faker->name,
//                'phone'=>$faker->phoneNumber,
//                'email'=>$faker->email,
//                'role'=>mt_rand(1,5000),
//                'is_use'=>mt_rand(1,2),
//            ];
//        }
//
//        Admin1::insert($data);

        //变更数据
        for ($i=1;$i<=10000;$i++){

            $data = [
                'created_at'=>date('Y-m-d H:m:s',mt_rand(strtotime('2018-01-01'),strtotime('2018-12-30'))),
                'updated_at'=>date('Y-m-d H:m:s',mt_rand(strtotime('2018-01-01'),strtotime('2018-12-30'))),
            ];
            Admin1::where('id','=',$i)->update($data);
        }


    }
}
